package com.lengxf.pay.common.bean;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;

@Data
@EqualsAndHashCode(callSuper = true)
public class PayOrder extends PayOrderAttrs {

    //商品名称
    private String productName;

    //商品描述
    private String productDesc;

    //价钱
    private BigDecimal price;

    //订单备注
    private String remark;

    //订单号 由本系统生成
    private String orderNo;

    //支付订单创建ip
    private String orderCreateIp;

    //订单过期时间
    private LocalDateTime expireTime;


    public int getExpireSeconds() {
        if (Objects.isNull(expireTime)) {
            return 60 * 1000;
        }
        return expireTime.getSecond() - LocalDateTime.now().getSecond();
    }

}
